Skip to content

Conversation

@richardfogaca
Copy link
Contributor

@richardfogaca richardfogaca commented Feb 3, 2026

SUMMARY

The Currency code column dropdown in the Dataset Editor excludes calculated columns that don't have a data type set, even though they are valid choices for currency code mapping (e.g. a CASE statement that maps country values to ISO currency codes like USD, EUR).

Root cause: The dropdown filters on type_generic === GenericDataType.String, but the backend only resolves type_generic for physical columns. Calculated columns without an explicitly set data type have type_generic as null, so they fail the check.

Fix: Include calculated columns whose type_generic is null (untyped), while still excluding calculated columns the user explicitly typed as NUMERIC, BOOLEAN, or DATETIME via the Data Type dropdown:

 const stringColumns = allColumns
-  .filter(col => col.type_generic === GenericDataType.String)
+  .filter(
+    col =>
+      col.type_generic === GenericDataType.String ||
+      (col.expression && col.type_generic == null),
+  )

Fixes #37620

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before — calculated column num_california is missing from the dropdown:
before

After — calculated column num_california now appears in the dropdown:
after

TESTING INSTRUCTIONS

  1. Open a dataset in the Dataset Editor (e.g. birth_names)
  2. Go to the Calculated columns tab and verify a calculated column exists (or add one, e.g. CASE WHEN state = 'CA' THEN 'USD' ELSE 'EUR' END)
  3. In the Default Column Settings section at the top, open the Currency code column dropdown
  4. Verify the calculated column appears in the dropdown alongside the physical string columns
  5. Add another calculated column typed as NUMERIC — verify it does not appear
  6. Verify numeric physical columns (e.g. num, num_boys) do not appear
  7. Select the calculated column and click Save — verify it persists

Unit tests:

npm run test -- --testPathPatterns='DatasourceEditorCurrency' --no-coverage

ADDITIONAL INFORMATION

…down

The currency code column dropdown in the Dataset Editor only showed
physical columns with type_generic === String, which excluded calculated
columns because the backend does not resolve type metadata for them.
Loosen the filter to also include columns with a truthy expression,
so calculated columns (e.g. CASE statements mapping countries to
currency codes) appear in the dropdown.
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 3, 2026

Code Review Agent Run #1c4f0f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 4e3da4e..4e3da4e
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Feb 3, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Sequence Diagram

Shows the fix where the Dataset Editor includes calculated columns (identified by a truthy expression) when building the currency code dropdown, despite those columns lacking backend-resolved type metadata.

sequenceDiagram
    participant DatasetEditor
    participant Backend
    participant Dropdown
    participant User

    DatasetEditor->>Backend: fetch_metadata()
    Backend-->>DatasetEditor: columns (physical cols have type_generic; calculated cols lack type_generic but include expression)
    DatasetEditor->>Dropdown: Build options filtered by (type_generic == String OR expression)
    Dropdown-->>User: Render currency code list (includes calculated columns)
Loading

Generated by CodeAnt AI

@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4e3da4e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6981540c7fe953000792b4ee
😎 Deploy Preview https://deploy-preview-37621--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

… currency dropdown

Narrow the filter to only include untyped calculated columns (type_generic
is null) rather than all calculated columns. Calculated columns that the
user explicitly typed as NUMERIC/BOOLEAN/DATETIME are now correctly excluded.
@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 3, 2026
richard added 2 commits February 3, 2026 11:49
The ColumnObject type requires `type` to be a string, not null.
Avoid includes('amount') matching 'total_amount' by using exact text
comparison for numeric column assertions.
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 3, 2026

Code Review Agent Run #06560a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 4e3da4e..713f38f
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(dataset-editor): Calculated columns excluded from Currency Code column dropdown

1 participant